#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;

template <class T>
void Swap(T &m,T &n)
{
	T q=m;
	m=n;
	n=q;
}
template <class T>
int Partition(T a[],int p,int r)
{
	int i=p;
	int j=r+1;
	T x=a[p];
	while(true){
		while(a[++i]<x&&i<r);
		while(a[--j]>x);
		if(i>=j)break;
		Swap(a[i],a[j]);
	}
	a[p]=a[j];
	a[j]=x;
	return j;
}

template <class T>
void QuickSort(T aa[],int p,int r)
{
	if(p<r){
		int q=Partition(aa,p,r);
		QuickSort(aa,p,q-1);
		QuickSort(aa,q+1,r);
	}
}

int main()
{
	int n;
	while(cin>>n)
	{
		int *a=new int[n];
		for(int i=0;i<n;i++)cin>>a[i];
		QuickSort(a,0,n-1);
		//sort(a,a+n);
		int k=0;
		int found=0;
		for(int i=1;i<n;i++)
		{
			if(a[i-1]==a[i])k++;
			else 
			{
				if(!k){a[found] = a[i-1];found++;}
				else k=0;
			}
		}
		if(!found)cout<<0<<endl;
		else 
		{
			cout<<found<<endl;
			for(int j=0;j<found-1;j++)cout<<a[j]<<' ';
			cout<<a[found-1]<<endl;
		}
	}
}
